package com.juzipi.demo.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.juzipi.demo.mapper.UserMapper;
import com.juzipi.demo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {


    @Autowired
    private UserMapper userMapper;


    public User checkUser(String username){
//        QueryWrapper<User> wrapper = new QueryWrapper<>();
//        wrapper.eq("username",username);

        return userMapper.selectOne(new QueryWrapper<User>().lambda().eq(User::getUsername,username));
    }


    public void createUser(User user){
        userMapper.insert(user);
    }


    public User queryUserById(Long userId) {

        return userMapper.selectById(userId);
    }
}
